package study.stream.文件生成流;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Author 金贵权
 * @Date 2023/6/21 17:02
 **/
public class Demo01 {
    public static void main(String[] args) {
        try (Stream<String> lines = Files.lines(Paths.get("my note"), Charset.defaultCharset())){
            List<String> collect = lines.flatMap(x -> Arrays.stream(x.split(" "))).distinct().collect(Collectors.toList());
            System.out.println(collect);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
